subroutine cfl(mx, bl, c_case, x, Cu, dx, dt, cfln)
    implicit none
    integer :: mx, bl
    integer :: c_case
    integer :: i

    real(8) :: dx, dt, cfln
    real(8) :: x(-bl:mx+bl)
    real(8) :: Cu(-bl:mx+bl)

    real(8) :: tmax_x, eps

    eps = 1d-20
    tmax_x = 0.d0
    select case(c_case)
    case(1,2)
        ! ---------- 1. u/-u ----------
        dt=8.d0*dx**(5.d0/3.d0)! / ((tmax_x / dx) + (tmax_y / dy) + eps)
    !print *,tmax_x
    !dt=dx*cfln/(tmax_x+eps)
    case(3,4,5,6,7,8,9)
        ! ---------- 1. u/-u ----------
        dt=dx/2.d0! / ((tmax_x / dx) + (tmax_y / dy) + eps)
    case default
        stop'cfl: zero pivot at first row'
    endselect
    
    if (dt < 0.d0) stop 'dt: zero pivot at first row'

end subroutine
